package at.fhj.antesk.steamvaluecalc;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

public class Account {

	private BigDecimal id = new BigDecimal(-1);
	private String name = "none";
	private byte visibilityState = -1;
	private String avatarIconUrl = "none";
	private String customUrl = "none";
	private Timestamp lastChecked = new Timestamp(0);
	private List<Game> games = new ArrayList<Game>();

	public Account(BigDecimal id, String name, byte visibilityState, String avatarIconUrl, String customUrl,
			Timestamp lastChecked, List<Game> games) {
		super();
		this.id = id;
		this.name = name;
		this.visibilityState = visibilityState;
		this.avatarIconUrl = avatarIconUrl;
		this.customUrl = customUrl;
		this.lastChecked = lastChecked;
		this.games = games;
	}

	public Account() {

	}

	public BigDecimal getId() {
		return id;
	}

	public void setId(BigDecimal id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public byte getVisibilityState() {
		return visibilityState;
	}

	public void setVisibilityState(byte visibilityState) {
		this.visibilityState = visibilityState;
	}

	public String getAvatarIconUrl() {
		return avatarIconUrl;
	}

	public void setAvatarIconUrl(String avatarIconUrl) {
		this.avatarIconUrl = avatarIconUrl;
	}

	public String getCustomUrl() {
		return customUrl;
	}

	public void setCustomUrl(String customUrl) {
		this.customUrl = customUrl;
	}

	public Timestamp getLastChecked() {
		return lastChecked;
	}

	public void setLastChecked(Timestamp lastChecked) {
		this.lastChecked = lastChecked;
	}

	public List<Game> getGames() {
		return games;
	}

	public void setGames(List<Game> games) {
		this.games = games;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((avatarIconUrl == null) ? 0 : avatarIconUrl.hashCode());
		result = prime * result + ((customUrl == null) ? 0 : customUrl.hashCode());
		result = prime * result + ((games == null) ? 0 : games.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((lastChecked == null) ? 0 : lastChecked.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + visibilityState;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Account other = (Account) obj;
		if (avatarIconUrl == null) {
			if (other.avatarIconUrl != null)
				return false;
		} else if (!avatarIconUrl.equals(other.avatarIconUrl))
			return false;
		if (customUrl == null) {
			if (other.customUrl != null)
				return false;
		} else if (!customUrl.equals(other.customUrl))
			return false;
		if (games == null) {
			if (other.games != null)
				return false;
		} else if (!games.equals(other.games))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (lastChecked == null) {
			if (other.lastChecked != null)
				return false;
		} else if (!lastChecked.equals(other.lastChecked))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (visibilityState != other.visibilityState)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Account [id=" + id + ", name=" + name + ", visibilityState=" + visibilityState + ", avatarIconUrl="
				+ avatarIconUrl + ", customUrl=" + customUrl + ", lastChecked=" + lastChecked + ", games=" + games + "]";
	}

}
